package com.edushare.common.standalonetests;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;

import org.apache.cayenne.DataObjectUtils;
import org.apache.cayenne.access.DataContext;

import com.edushare.common.vo.Universities;
import com.edushare.common.vo.UserRoles;
import com.edushare.common.vo.Users;

public class UniversityListFromUser {

	public static void main(String[] args) {/*
		
		BufferedWriter w = null;
		try {
			w = new BufferedWriter(new FileWriter("C:/cayenne.out"));
			DataContext ctx = DataContext.createDataContext();
//			Users u = (Users)ctx.newObject(Users.class);
			Users u = (Users)DataObjectUtils.objectForPK(ctx, Users.class, 656);
			List<UserRoles> ur = (new UserRoles()).getUserRoles(u, UserRoles.SORT_BY_UNIV_NAME, false, 5);
			System.out.println("L : "+ ur.size());
			
			for(UserRoles rl : ur){
				Universities un = rl.getUniversity();
				System.out.println(">> " + un.getUniversityName());
				w.write(un.getUniversityName());
				w.newLine();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			try {
				w.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	*/}

}
